function classes<T,D>(name:T,id:D):[T,D]{
    return [name,id]
}
let res = classes("Voldy",9)
console.log(res)

function num<T,K extends keyof T>(name:T,len:K){
    return name[len]
}
let res1 = num ("HelloWorld","length")
console.log(res1)

//字面量
type addminster = "Voldy" | "sfc"
function user<T extends addminster>(UserName:T){
    return UserName
}
let res2 = user("Voldy")
console.log(res2)

type numb = number | string
function  sum<X extends numb>(sums:X){
    return sums
}
let res3 = sum("sada")
console.log(res3)